import { Message } from "element-ui";

//时间改造
export default {
    formateDate(datetime) {
        function addDateZero(num) {
            return (num < 10 ? "0" + num : num);
        }
        let d = new Date(datetime);
        let formatdatetime = d.getFullYear() + '-' +
                            addDateZero(d.getMonth() + 1) + '-' +
                            addDateZero(d.getDate()) + ' ' +
                            addDateZero(d.getHours()) + ':' +
                            addDateZero(d.getMinutes()) + ':' +
                            addDateZero(d.getSeconds());
        return formatdatetime;
    },
    formateDate2(datetime) {
        function addDateZero(num) {
            return (num < 10 ? "0" + num : num);
        }
        let d = new Date(datetime);
        let formatdatetime = d.getFullYear() + '-' +
          addDateZero(d.getMonth() + 1) + '-' +
          addDateZero(d.getDate());
        return formatdatetime;
    },
}
